<?php
class Admin_Form_Admin extends Zend_Form
{

    public function init()
    {
        $this->setName("admin");

        $id = new Zend_Form_Element_Hidden('id');
        $id->addFilter('Int');
        
        $username = new Zend_Form_Element_Text('username');
        $username->setLabel('Tên tài khoản')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $username->setAttrib('size', 60);
        
        $password = new Zend_Form_Element_Password('password');
        $password->setLabel('Mật khẩu')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $password->setAttrib('size', 60);                
                        
        $full = new Zend_Form_Element_Text('fullname');
        $full->setLabel('Tên')->addFilter('StripTags')->addFilter('StringTrim');
        $full->setAttrib('size', 60);                        
                        
        $ava =new Zend_Form_Element_File('avatar');                        
        $ava->setLabel('Thay đổi Logo');                          
        $ava->addValidator('Extension',true,array('jpg','gif','png'),'picture');                 
        $ava->addValidator('Size',true,array('min'=>'0KB','max'=>'40KB'),'picture');
        $ava->setAttrib('size', 60);                        
                        
        $status = new Zend_Form_Element_Select('status');
        $status->setLabel('Trạng thái');
        $status->addMultiOption('1','Đang hoạt động');
        $status->addMultiOption('0','Tạm khóa');

        // submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id','submitbutton');
        $submit->setAttrib('class',"button medium");
                
        // add elements to form
        $this->addElements(array (
            $id, $username, $password, $full,  $ava, $status, $submit
        ));
    }
}

